<?php

namespace common\models\member;

use Yii;

/**
 * This is the model class for table "{{%member_attr}}".
 *
 * @property int $member_id
 * @property int $project_id 所属项目ID
 * @property int $department_id 所属部门ID
 * @property int $clinic_id 所属诊室
 * @property int $profession_id 岗位ID
 * @property string $profession_name 所属岗位名称（冗余字段）
 * @property int $is_department_leader 是否为负责人【0：普通员工、1：部门负责人 2：项目负责人】
 * @property int $created_at 添加时间
 * @property int $updated_at 更新时间
 */
class Attr extends \common\models\BaseModel
{
    const IS_DEPARTMENT_LEADER_NO = 0;// 普通员工
    const IS_DEPARTMENT_LEADER_YES = 1;// 部门负责人
    const IS_DEPARTMENT_LEADER_PROJECT = 2;// 项目负责人

    public static $departmentLeaderName = [
        self::IS_DEPARTMENT_LEADER_NO => '普通员工',
        self::IS_DEPARTMENT_LEADER_YES => '部门负责人',
        self::IS_DEPARTMENT_LEADER_PROJECT => '项目管理员',
    ];

    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%member_attr}}';
    }

    public static function primaryKey()
    {
        return ['member_id','project_id'];
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['member_id', 'project_id', 'department_id', 'clinic_id', 'profession_id', 'is_department_leader', 'created_at', 'updated_at'], 'integer'],
            [['profession_name'], 'string', 'max' => 100],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'member_id' => 'Member ID',
            'project_id' => '所属项目ID',
            'department_id' => '所属部门ID',
            'clinic_id' => '所属诊室',
            'profession_id' => '岗位ID',
            'profession_name' => '所属岗位名称（冗余字段）',
            'is_department_leader' => '是否为负责人【0：普通员工、1：部门负责人 2：项目负责人】',
            'created_at' => '添加时间',
            'updated_at' => '更新时间',
        ];
    }
}
